import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
		path: '/',
		name: 'Home',
		component: Home
	},
	{
		path: '/list',
		name: 'List',
		component: () => import('../views/List.vue')
	},
	{
		path: '/details',
		name: 'Details',
		component: () => import('../views/Details.vue')
	},
	{
		path: '/cart',
		name: 'Cart',
		component: () => import('../views/Cart.vue')
	},
	{
		path: '/login',
		name: 'Login',
		component: () => import('../views/Login.vue')
	},
	{
		path: '/register',
		name: 'Register',
		component: () => import('../views/Register.vue')
	},
	{
		path:'/order',
		name:'Order',
		component:() => import('../views/Order.vue')
	}
]

const router = new VueRouter({
	routes,
	scrollBehavior(to, from, savedPosition) {
		// return 期望滚动到哪个的位置
		return {
			x: 0,
			y: 0
		}
	}
})



export default router
